package com.minyifang.wcspf.work.ui.user.presenter;

import com.minyifang.wcspf.common.base.BasePresenter;
import com.minyifang.wcspf.common.config.network.Constants;
import com.minyifang.wcspf.common.config.network.RetrofitHelper;
import com.minyifang.wcspf.common.config.user.UserManager;
import com.minyifang.wcspf.common.md5.SafeUtils;
import com.minyifang.wcspf.work.model.HttpRespond;
import com.minyifang.wcspf.work.ui.user.view.ForgetPwdNextView;
import com.minyifang.wcspf.work.ui.user.view.MyWalletView;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class MyWalletPresenter extends BasePresenter<MyWalletView> {

    public void getBalance() {
        getView().showLoadingView();
        JSONObject jsonData = Constants.getJsonData(null, UserManager.getInstance().getToken());
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonData.toString());
        addTask(RetrofitHelper.getInstance().getService().getBalance(requestBody), respond -> {
            getView().hideLoadingView();
            getView().showBalanceRes(respond);
        });
    }
}
